<template>
		<div class="ele-body">
			<div style="background-color: #FFFFFF; padding: 8px 5px 3px 5px; margin-bottom: 8px; ">
				<el-row class="oneRow">
					<!-- 第一行按钮 -->
						<el-col class="oneColSwitch">
						<el-tooltip class="item" effect="dark" content="是否保存后保留数据" placement="top-start">
							<vxe-switch v-model="sfbl" open-label="保留" :open-value="1" close-label="不留" :close-value="0" size="mini"></vxe-switch>
						</el-tooltip>
						</el-col>
						<el-col class="oneCol">
							<el-tooltip content="保存" placement="top-start">
								<vxe-button class="oneButton" @click="save">保存</vxe-button>
							</el-tooltip>
						</el-col>
						<el-col class="oneCol">
							<el-tooltip content="商品选择" placement="top-start">
								<vxe-button class="oneButton" @click="xzButton('xz')">选择</vxe-button>
							</el-tooltip>
						</el-col>
						<el-col class="oneCol">
							<el-tooltip content="删除" placement="top-start">
								<vxe-button class="oneButton" @click="mxscButton">删除</vxe-button>
							</el-tooltip>
						</el-col>
						<el-col class="oneCol">
							<el-tooltip content="单据修改" placement="top-start">
								<vxe-button class="oneButton" @click="xgButton">修改</vxe-button>
							</el-tooltip>
						</el-col>
						<el-col class="oneCol">
							<el-tooltip content="查询" placement="top-start">
								<vxe-button class="oneButton" @click="selectAll">查询</vxe-button>
							</el-tooltip>
						</el-col>
						<el-col class="oneCol">
							<el-tooltip content="更多" placement="top-start">
								<vxe-button class="oneButton2" status="primary" icon="el-icon-menu" @click="sxgdButton"></vxe-button>
							</el-tooltip>
						</el-col>
						
				</el-row>
				
				<!--======筛选面板====== -->
				<div class="CTon_cs" v-show="showMore">
					<el-col class="more-input"><vxe-button type="text" status="success" content="商品新增" @click="xzButton('bc')"></vxe-button></el-col>
					<el-col class="more-input"><vxe-button type="text" status="success" content="客户新增" @click="xzButton('kh')"></vxe-button></el-col>
					<el-col class="more-input"><vxe-button type="text" status="success" content="品牌新增" @click="xzButton"></vxe-button></el-col>
					<el-col class="more-input"><vxe-button type="text" status="success" content="销售分析" @click="xzButton('fx')"></vxe-button></el-col>
					<el-col class="more-input"><vxe-button type="text" status="success" content="盈利分析" @click="dialogVisible=true"></vxe-button></el-col>
					<el-col class="more-input"><vxe-button type="text" status="success" content="盈利" @click="dialogVisible2=true"></vxe-button></el-col>
				</div>
				
				<!-- 选择下拉div -->
					<el-row class="twoRow">
						<el-col class="twoCol">
							<span class="spanClass">单据编号：</span>
								<el-input class="twoInput" v-model="selectDjbh" :disabled="true"  clearable placeholder="单据编号">
								</el-input>
						</el-col>
						<el-col class="twoCol">
							<span class="spanClass">客户：</span>
								<el-select v-model="selectKh"
								placeholder="客户"
								filterable
								remote
								:remote-method="tjcxKh"
								@change="handleSelectChange">
									<el-option v-for="item in khList" :key="item.id" :label="item.name" :value="item.id">
										<span style="float: left">{{ item.name}}&nbsp;</span>
										<span style="float: right; color: #666666; font-size: 13px">{{ item.code }}</span>
									</el-option>
								</el-select>
						</el-col>
						<el-col class="twoCol">
							<span class="spanClass">品牌：</span>
								<el-input class="twoInput" v-model="selectPp" :disabled="true"  clearable placeholder="品牌名称">
								</el-input>
						</el-col>
						<el-col class="twoCol">
							<span class="spanClass">日期：</span>
								<el-date-picker class="twoInput" v-model="djDate" type="date" placeholder="单据日期"></el-date-picker>
						</el-col>
					</el-row>
			</div>
			
			
			
			
			
			<div class="tableDiv">
				<el-row>
					<el-col class="ysy-table1">
						<vxe-toolbar custom>
							<template v-slot:buttons>
								<el-row class="threeRow">
								<span class="spanClass">备注：</span>
								<vxe-input class="threeInput" v-model="inputBz"></vxe-input>
								</el-row>
							</template>
						</vxe-toolbar>
						<vxe-table 
						auto-resize 
						ref="refTable1"
						border 
						show-header-overflow 
						show-overflow
						highlight-hover-row
						height="600"
						class="mytable-scrollbar" 
						size="mini"
						highlight-current-row 
						resizable
						:data="table1"
						@edit-actived="handleCellDblClickTable1"
						@edit-closed="tableEditClosed"
						@keydown="insertKeyDown"
						@cell-mouseenter="table1Mouseenter"
						show-footer
						:footer-method="table1Footer"
						:loading="xsmxLoading"
						:sortable="sortableConfig"
						:edit-config="{trigger: 'click', mode: 'cell'}"
						:class="{ 'custom-background': bodyBackgroundColor}"
						>
						<vxe-table-column type="checkbox" width="40"></vxe-table-column>
						<vxe-table-column type="seq" title=" " width="40"></vxe-table-column>
						<vxe-table-column field="action" title="操作" width="100" align="center">
						<template v-slot="{ row }">
							<vxe-button type="text" status="success" content="加" size="mini" @click="insertEvent(row)"></vxe-button>
							<vxe-button type="text" status="danger" content="减" size="mini" @click="table1DelEvent(row)"></vxe-button>
						</template>
						</vxe-table-column>
						<vxe-table-column field="sptp" title="图片" type="html" :formatter="formatImg" width="55px" :visible="$setting.showImg" ></vxe-table-column>
						<vxe-table-column field="spmc" title="品牌" width="80" align="center" :edit-render="{name: 'input', attrs: {type: 'text'}}"></vxe-table-column>
						<vxe-table-column field="je" title="销售金额" min-width="80" align="center" :edit-render="{name: 'input', attrs: {type: 'text'}}"></vxe-table-column>
						<vxe-table-column field="px" title="排序" min-width="90" align="center" :visible="false"></vxe-table-column>
						<vxe-table-column field="id" title="id" min-width="90" align="center" :visible="false"></vxe-table-column>
						<vxe-table-column field="spid" title="spid" min-min-width="90" align="center" :visible="false"></vxe-table-column>
						<vxe-table-column field="createtime" title="创建时间" min-width="90" align="center" :visible="false"></vxe-table-column>
						</vxe-table>

					</el-col>
				</el-row>
			</div>
			
			<!-- 盈利分析-->
			<el-dialog
			title="盈利分析"
			:visible.sync="dialogVisible"
			width="40%">
			<el-form ref="form" :model="form" label-width="80px">
			<el-form-item label="售罄率">
			<el-input v-model="form.sql"></el-input>
			</el-form-item>
			<el-form-item label="毛利率">
			<el-input v-model="form.mll"></el-input>
			</el-form-item>
			<el-form-item label="费用率">
			<el-input v-model="form.fyl"></el-input>
			</el-form-item>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-tooltip placement="top">
					<div slot="content">回报率=销售金额/采购金额=销售金额/销售金额*（1-毛利率）/售罄率=售罄率/（1-毛利率）。</div>
					<vxe-button type="text" >回笼率:{{this.hll}}</vxe-button>
				</el-tooltip>
				<el-tooltip placement="top">
					<div slot="content">企业红线=销售额+费用/采购成本=企业收入/企业收入（1-费用率）=1/（1-费用率）。</div>
					<vxe-button type="text" >企业红线:{{this.qyhx}}</vxe-button>
				</el-tooltip>
				<el-button @click="dialogVisible = false">关 闭</el-button>
				<el-button type="primary" @click="jSbutton()">计 算</el-button>
			</span>
			</el-dialog>
			
			<!-- 盈利分析-->
			<el-dialog
			title="盈利分析2"
			:visible.sync="dialogVisible2"
			width="40%">
			<el-form ref="form" :model="form" label-width="80px">
			<el-form-item label="开始价">
			<el-input v-model="form.sql"></el-input>
			</el-form-item>
			<el-form-item label="最高价">
			<el-input v-model="form.mll"></el-input>
			</el-form-item>
			<el-form-item label="差价">
			<el-input v-model="form.fyl"></el-input>
			</el-form-item>
			<el-form-item label="毛利率">
			<el-input v-model="hll"></el-input>
			</el-form-item>
			<el-form-item label="回本售罄率">
			<el-input v-model="qyhx"></el-input>
			</el-form-item>
			<el-form-item label="商品:">
				<el-select style="width:100%" placeholder="请输入" v-model="form.spid"  clearable
					filterable  ref="select" >
					<el-option v-for="item in options_sp" :key="item.id" :label="item.name"
						:value="item.id"></el-option>
				</el-select>
			</el-form-item>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-tooltip placement="top">
					<div slot="content">毛利率=(最高价-开始价)/最高价。</div>
					<vxe-button type="text" >毛利率:{{this.hll}}</vxe-button>
				</el-tooltip>
				<el-tooltip placement="top">
					<div slot="content">1-毛利率</div>
					<vxe-button type="text" >回本售罄率:{{this.qyhx}}</vxe-button>
				</el-tooltip>
				<el-button @click="dialogVisible2 = false">关 闭</el-button>
				<el-button type="primary" @click="jSbutton2()">计 算</el-button>
				<el-button type="primary" @click="updateSpbz()">保 存</el-button>
			</span>
			</el-dialog>
			
			
			<!-- 客户新增-->
			<vxe-modal v-model="showKhxz"  width="56%" height="56%" :zIndex="1100"  escClosable show-zoom resize>
				<template v-slot:title>
						<div style="text-align: center;">客户新增</div>
				</template>
						<khxz-data ref="khxz" @khImport="khImport"/>
			</vxe-modal>
			
			<!-- 品牌新增-->
			<vxe-modal v-model="showPpxz"  width="80%" height="80%" :zIndex="1100"  escClosable show-zoom resize>
				<template v-slot:title>
						<div style="text-align: center;">品牌新增</div>
				</template>
						<ppxz-data />
			</vxe-modal>
			
			<!-- 商品新增-->
			<vxe-modal v-model="showSpxz"  width="70%" height="70%" :zIndex="1100"  escClosable show-zoom resize>
				<template v-slot:title>
						<div style="text-align: center;">商品新增或选择</div>
				</template>
						<spxz-data ref="spxz" @yxkh="yxkh" @selectAll="selectAll" @spImport="spImport"/>
			</vxe-modal>
			
			<!-- 导入客户-->
			<khmxImport
			:visible.sync="showImport" 
			@khlist="sxkhxz"/>
			
			<!-- 上传图片-->
			<spkhImport
			:visible.sync="tpImport" 
			ref="sctp" @khlist="sxkhxz"/>
			
			<!-- 单据修改-->
			<vxe-modal v-model="showxzDg"  width="80%" height="85%" :zIndex="1100"  escClosable show-zoom resize>
				<template v-slot:title>
						<div style="text-align: center;">单据修改</div>
				</template>
						<djxg-data  @daoruAll="daoruAll" />
			</vxe-modal>
			
			<!-- 销售分析-->
			<vxe-modal v-model="showXsfx"  width="80%" height="80%" :zIndex="1100"  escClosable show-zoom resize>
				<template v-slot:title>
						<div style="text-align: center;">销售分析</div>
				</template>
						<xsfx-data />
			</vxe-modal>
			
			<!-- 商品图片弹窗 -->
			<vxe-modal v-model="showSpxx" :title="'款号:'+this.spxxData.spbh" width="360" :zIndex="1200"  :position="{top:200, left:300}" :mask="false" :lock-view="false" >
				<img style="width: 330px;height: 440px;object-fit:contain" v-bind:src="this.spxxData.sptp" />
			</vxe-modal>

		</div>
</template>

<script>
	import spxzData from './spxz-data'
	import khxzData from './khxz-data'
	import ppxzData from './ppxz-data'
	import djxgData from './djxg-data'
	import xsfxData from './xsfx-data'
	import khmxImport from './khmx-import'
	import spkhImport from './spkh-import'
	import XEUtils from 'xe-utils'
	
	
	export default{
		components: {
			spxzData,
			khxzData,
			ppxzData,
			djxgData,
			xsfxData,
			khmxImport,
			spkhImport,
		},
		data() {
			return{
				khList:[] ,// 供应商
				options_sp: [],//商品
				selectKh:22,
				table1:[],
				selectLry:'',
				lryList:[],
				inputBz:'',
				xsmxLoading:false,
				sortableConfig: true,
				showSpxz:false,
				showKhxz:false,
				showPpxz:false,
				showXsfx:false,
				showImport:false,
				tpImport:false,
				showxzDg:false,
				showMore:false,
				showCsck:false,
				selectDjbh:'',
				selectPp:'数字商品',
				bianjiGe:'',
				djDate:new Date(),
				Id:'',
				ld:1100,
				showSpxx:false,
				spxxData:{},
				bodyBackgroundColor: true,//背景颜色
				dialogVisible:false,//盈利分析
				dialogVisible2:false,
				hll:0,//回笼率
				qyhx:0,//企业红线
				//表单数据
				form: {
					spid:'',
					mll:0,
					sql:0,
					fyl:0
					},
				sfbl:1
				
			}
		},
	methods:{
		selectAll(value){
			console.log('进入',this.djDate)
			//查询已存在的销售明细
			this.$http.post("/scm/scm/xsmx/selectXsmx").then(res => {
				this.table1  = res.data;
				if(value){
					this.showSpxz = false;
				}
			})
		},
		
		getsp(){
			//商品
			this.$http.post('/scm/scm/xsmx/getspid').then(res => {
				this.options_sp = res.data.data;
			})
		},
		updateSpbz(){//保存回本售罄率
			// console.log(khmc,'khmc');
			this.$http.post("/scm/scm/xsmx/updateSpbz",{
				spid:this.form.spid,
				qyhx:this.qyhx
			}).then(res=>{
				this.$message.success(res.data.msg)
			})
		},
		//保存销售
		save(){
			if(this.table1.length <= 0){
				this.$message.info("请选择需要保存的商品")
				return;
			}
			var bool = false;
			var itemPpmc = '';
			for (let i = 0; i < this.table1.length; i++) {
				let item = this.table1[i];
				if (item.je === null) {
					itemPpmc = item.spmc;
					bool = true;
					break;
				}
			}
			if(bool){
				this.$message.info("请给（"+itemPpmc+"）填写金额")
				return;
			}
			if(this.selectKh == null || this.selectKh == ''){
				this.$message.info("请选择客户")
				return;
			}
			
			if(this.djDate == null || this.djDate == ''){
				this.$message.info("请选择单据日期")
				return;
			}
			
			this.$http.post("/scm/scm/xsmx/bcXsmx",{
				khid : this.selectKh,
				djrq : this.$util.toDateString(this.djDate, 'yyyy-MM-dd'),
				sfbl: this.sfbl,
				djbh:this.selectDjbh,
				bz:this.inputBz,
			}).then(res => {
				if(res.data.code == 0){
					this.$message.success(res.data.msg)
					this.selectKh = null
					this.selectPp =null
					this.djDate =null
					this.selectAll();
				}else{
					this.$message.info(res.data.msg)
				}
			})
		},
		//计算
		jSbutton(){
			//console.log(this.form,'from');
			this.hll=Math.round((this.form.sql)/100/(1-(this.form.mll/100))*100);
			this.qyhx=Math.round(1/(1-(this.form.fyl/100))*100);
		},
		
		//计算
		jSbutton2(){
			//console.log(this.form,'from');
			this.form.fyl=this.form.mll-this.form.sql;
			this.hll=this.form.fyl/this.form.mll;
			this.qyhx=1-this.hll;
		},
		//新增按钮
		xzButton(lx,id){
			if(lx=='xz'){
				this.showSpxz = true;//商品选择
				// try {
				// 	this.$refs.spxz.sfXz();
				// 	} catch (error) {
				// 	// 捕获并处理异常
				// 	console.error("An error occurred while calling sfXz():", error);
				// 	// 在这里可以添加处理异常的逻辑，比如提示用户或者进行其他操作
				// }
				this.$nextTick(() => {
					this.$refs.spxz.sfXz('xz');
				});
			}else if(lx=='xg'){
				this.showSpxz = true;//商品选择
				this.$nextTick(() => {
					this.$refs.spxz.sfXz(lx,id);
				});
			}else if(lx=='kh'){
				this.showKhxz = true;//客户新增
			}else if(lx=='fx'){
				this.showXsfx = true;//销售分析
			}else if(lx=='bc'){
				this.showSpxz = true;//商品新增
				this.$nextTick(() => {
					this.$refs.spxz.sfXz('bc');
				});
			}else{
				this.showPpxz = true;//品牌新增
			}
		},
		//条件查询客户
		tjcxKh(kh){
			this.$http.post("/scm/scm/xsmx/khlist",{
				code : kh,
				limit:30
				}).then(res => {
				if(res.data.code === 0){
					this.khList = res.data.data
				}
			})
		},
		//删除全部的销售明细
		mxscButton(){
			this.$confirm('清空所有销售明细吗？', '注意！！！', {
				type: 'warning'
			}).then(() => {
				this.$http.post("/scm/scm/xsmx/deleteMx")
				.then(res => {
					if(res.data.code == 0){
						this.$message.success(res.data.msg)
						this.selectAll();
					}else{
						this.$message.info(res.data.msg)
					}
				})
			})
		},
		handleSelectChange(kh){
			// console.log(kh,'进入');
			// console.log(this.khList,'进入1');
			// console.log(this.khList.find(item => item.id === kh).code,'进入');
			this.selectPp=this.khList.find(item => item.id === kh).ppmc;
		},
		khImport(){//客户导入
			this.showImport=true;
		},
		spImport(id){//上传图片
			//console.log('进去');
			this.tpImport=true;
			this.$nextTick(() => {
				this.$refs.sctp.getid(id);
			});
		},
		xgButton(){
			this.showxzDg=true;
		},
		sxkhxz(){
			//console.log('进入');
			this.$refs.khxz.selectAll();
		},
		yxkh(){
			this.$refs.spxz.sfXz();
		},
		sxgdButton(){
			//console.log('进入');
			this.showMore = this.showMore ? false : true;
		},
		handleCellDblClickTable1({
			column
		}) {
			//console.log(column,'column')
			this.bianjiGe= column.property
		},
		daoruAll(khid,djrq,djbh,bz){
			//console.log('进入');
			this.selectAll();
			this.showxzDg=false;
			this.selectKh=khid;
			this.djDate=djrq;
			this.selectDjbh=djbh;
			this.inputBz=bz;
		},
		//结束编辑格
		tableEditClosed(row){
			//console.log(row,'row');
			
			var cm = this.bianjiGe;
			this.EditClosed = cm;
			
			if(this.EditClosed=='je' ){
				this.jexg(row.row.id,row.row.je);//修改金额
			}else{
				this.xzButton('xg',row.row.id);
			}
		},
		//快捷键操作
		insertKeyDown(event){
			//console.log(event,'event')
			
			var xTable ='';
			var enterField = 'px'; 
			
				xTable = this.$refs.refTable1;
			
			//通用快捷键操作
			this.fastKeyAction(event, xTable, enterField);
		},
		//通用快捷键操作
		fastKeyAction(event, xTable, enterField) { //fastKeyAction(event, xTable) {
			//console.log(event)
			//获取当前选中单元格
			var cell = xTable.getSelectedCell(); //xTable.getActiveRecord()
			var rowid = null;
			var rowidNew = null; //跳到新行的ID
			var columnId = null; //跳到新列的ID
			//console.log("快捷键："+event.$event.keyCode)
			
			if(cell==null) {
				//console.log("cell为空");
				cell = xTable.getActiveRecord();
				//console.log(cell)
			}
			if(cell==null) {
				return;
			}
			
			rowid = cell.row._XID; //cell.rowid; cell.row._XID;
			
			if(event.$event.keyCode==13) { //回车键
				//方式1 按回车键向右移动，然后遇到采购价列回车则激活下一行第一列可编辑的单元格
				var enterColumnId = xTable.getColumnIndex(xTable.getColumnByField(enterField))-1; //获取需回车换行列的索引，注意需要减去1，则在前1列就会跳到下一行
				if(cell.columnIndex==enterColumnId || cell.column.property==enterField){ //if(cell.column.property==enterField){ 
					rowidNew = 'row_'+(parseInt(rowid.substring(4))+1); //获下一行id
					//console.log(cell,'cell');
					//获取当前行，当前列，选中颜色列，则跳到下一行  //
					columnId = xTable.getColumns()[cell.columnIndex-1].id; //列的唯一ID
					xTable.setActiveCell( xTable.getRowById(rowidNew), xTable.getColumnById(columnId).property );
					//xTable.setActiveRow(xTable.getRowById(rowidNew));//激活下一行行编辑并激活第一个单元格   //xTable.setSelectCell(xTable.getRowById(rowidNew), 'fhj');
				}else{
					if(cell.columnIndex < (xTable.getColumns().length-1)) { //加个判断，避免最后1列异常
						columnId = xTable.getColumns()[cell.columnIndex +1].id; //往右1列的唯一列ID
						xTable.setActiveCell( xTable.getRowById(rowid), xTable.getColumnById(columnId).property ); //激活当前行往右1个单元格
					}
				}
				
				// 方式2 按回车键先下移动，激活下一行当前列的单元格
				// rowidNew = 'row_'+(parseInt(rowid.substring(4))+1); //获取当前行id
				// columnId = xTable.getColumns()[cell.columnIndex].id; //列的唯一ID
				// xTable.setActiveCell( xTable.getRowById(rowidNew), xTable.getColumnById(columnId).property );
			}else if(event.$event.keyCode==40){ //下方向键
				//获取当前行id
				rowidNew = 'row_'+(parseInt(rowid.substring(4))+1);
				columnId = xTable.getColumns()[cell.columnIndex].id; //列的唯一ID
				xTable.setActiveCell( xTable.getRowById(rowidNew), xTable.getColumnById(columnId).property );
				//console.log(xTable.getActiveRecord())
			}else if(event.$event.keyCode==38){ //上方向键
				//获取当前行id
				rowidNew = 'row_'+(parseInt(rowid.substring(4))-1);
				columnId = xTable.getColumns()[cell.columnIndex-1].id; //列的唯一ID
				xTable.setActiveCell( xTable.getRowById(rowidNew), xTable.getColumnById(columnId).property );
			}else if(event.$event.keyCode==39){ //右方向键
				//获取当前行id
				rowidNew = 'row_'+(parseInt(rowid.substring(4)));
				columnId = xTable.getColumns()[cell.columnIndex+1].id; //列的唯一ID
				xTable.setActiveCell( xTable.getRowById(rowidNew), xTable.getColumnById(columnId).property );
				}else if(event.$event.keyCode==37){ //左方向键
					//获取当前行id setSelectCell(row, field)
					rowidNew = 'row_'+(parseInt(rowid.substring(4)));
					columnId = xTable.getColumns()[cell.columnIndex-1].id; //列的唯一ID
					xTable.setActiveCell( xTable.getRowById(rowidNew), xTable.getColumnById(columnId).property );
				}
			},
			//表1 商品图片列格式化
			formatImg({ cellValue }) {
				var onerror = "this.style.display='none'"; //错误图片隐藏图片元素
				return '<img src="' + cellValue + '" style="height:30px;width:28px" onerror="'+onerror+'">';
			},
			
			//表1 鼠标移入事件
			table1Mouseenter(row) {
				//console.log(row,'row');
				this.showSpxx = false;
				if (row.column.property == 'sptp' && row.row.spid!=null) { //打开商品图片弹窗  row.column.property == 'sptp' row.columnIndex == 2
					this.$http.post('/scm/scm/xsmx/getProduct', { spid: row.row.spid }).then(res => {
						//console.log('res',res);
						this.spxxData = res.data.data;
					});
					this.showSpxx = true;
					return;
				}
			},
		//修改金额
		jexg(id,je){
			
			this.$http.post("/scm/scm/xsmx/updateJe",{
					id:id,
					je:je
			}).then(res => {
				if(res.data.code == 0){
					this.$message.success(res.data.msg)
					//this.selectAll();
				}else{
					this.$message.info(res.data.msg)
				}
			})
		},
		insertEvent(row) {
			this.$http.post("/scm/scm/xsmx/xZh",{
				px:row.px
			}).then(res => {
				if(res.data.code == 0){
					this.$message.success(res.data.msg)
					this.selectAll();
				}else{
					this.$message.info(res.data.msg)
				}
			})
		},
		table1DelEvent(row){
			//console.log(row);
			this.$confirm('确定要删除此行结果吗?', '提示', {
				type: 'warning'
			}).then(() => {
			this.$http.post("/scm/scm/xsmx/deleteXsmx",{
				spid:row.spid,
				id:row.id
			}).then(res => {
				if(res.data.code == 0){
					this.$message.success(res.data.msg)
					this.selectAll();
				}else{
					this.$message.info(res.data.msg)
				}
			})
		}
		)},
		//表1 表尾合计行
		table1Footer({ columns, data }) {
			return [
				columns.map((column ) => { //, columnIndex
					if(column.property == 'action') { //if(columnIndex === 3) {
						return '合计:'
					}else if(column.property == 'je') { //数量的合计
						return XEUtils.sum(data,'je');
					}
					return ''
				})
			]
		}
	},
	mounted(){
		this.selectAll();
		this.tjcxKh();
		this.getsp();
	}
	}
</script>

<style lang="scss" scoped>
	
	::v-deep .custom-background.vxe-table--render-default .vxe-table--body-wrapper {
		background-color: #cce8cf ; 
	}
	
	.oneRow{
		border-bottom: 1px solid lightgray;
	}
	.oneCol{
		width: 57px;
	}
	.oneColSwitch{
		width: 63px;
		align-self: flex-end;
	}
	.oneButton{
		width: 60px;
		height: 30px;
	}
	.oneButton2{
		width: 45px;
		height: 30px;
	}
	.twoRow{
		display: flex;
	}
	.twoCol{
		width: 260px;
		margin-top: 10px;
		margin-left: 5px;
		
	}
	.twoInput{
		height: 30px;
		width: 180px;
	}
	.threeRow{
		margin-left: 10px;
		margin-top: 0px;
	}
	.threeInput{
		width: 95%;
		height: 30px;
	}
	.spanClass{
		font-weight: 800;
		color:#161616;
	}
	.tableDiv{
		margin-top: -10px;
		height: 90%;
	}
	.ysy-table1 {
		font-weight: 500;
	}
	.CTon_cs {
		width: 90px;
		height: 200px; //每行30px
		position: absolute;
		left: 345px;
		z-index: 999;
		background: #ffffff;
		border-radius: 6px;
		border: 1px solid #f0f0f0;
		box-shadow: 0px 0px 10px 5px #f5f5f5;
	}
	.more-input {
		display: flex;
		width: 75px;
		margin-left: 8px;
		margin-top: 5px;
		height: 25px;
		border: 1px solid rgb(224, 230, 227);
		border-radius: 6px;
		background: rgb(250, 250, 250);
	}
	
</style>
